<html>
	<head>
	<script type="text/javascript" src="https://ajax.googleapis.com/ajax/libs/jquery/1.6.1/jquery.min.js"></script>
	<script type="text/javascript" src="sim-0.1.js"></script>
	<script type="text/javascript" src="buffet_restaurant.js"></script>
	<link rel="stylesheet" href="examples.css" type="text/css" />
	
	<script type="text/javascript">
	$(function () {
		$("#run_simulation").click(function () {
			
			var BuffetCapacity = parseFloat($('[name="BuffetCapacity"]').val());
			var PreparationTime = parseFloat($('[name="PreparationTime"]').val());
			var MeanArrival = parseFloat($('[name="MeanArrival"]').val());
			var CashierTime = parseFloat($('[name="CashierTime"]').val());
			var Seed = parseFloat($('[name="Seed"]').val());
			var Simtime = parseFloat($('[name="Simtime"]').val());
			
			
			var results = buffetRestaurantSimulation(
					BuffetCapacity,
					PreparationTime,
					MeanArrival,
					CashierTime,
					Seed,
					Simtime);
			
			var msg = "Simulation Results for ["
								+ "Buffet Capacity = " + BuffetCapacity
								+ ", Preparation Time = " + PreparationTime
								+ ", Mean Arrival = " + MeanArrival
								+ ", Mean Cashier time = " + CashierTime
								+ ", Seed = " + Seed
								+ ", Sim time = " + Simtime
								+ "]<br>"
								+ "Average time spent at restaurant (min) = " 
								+ results[0].toFixed(4)
								+ "<br>Average number of customers in restaurant = " 
								+ results[2].toFixed(4)
								+ "<hr>";
			$(".results").append(msg);
		});
		
		$("#clear_result").click(function () {
			$(".results").html('<a href="" id="clear_results">Clear</a><hr>');
		});
		
	});
	</script>
		
	</head>
	<body>
		<div class="header">
			<a href="buffet-restaurant.html">Back to documentation</a> | <a href="buffet_restaurant.js">View Source</a>
		</div>
		
		<div class="form">
		<table>
			<tr><td>Buffer Capacity: 
				<td><input type="text" name="BuffetCapacity" value="5.0"/> </tr>
			<tr><td>Salad preparation time (min):
				<td><input type="text" name="PreparationTime" value="5"/> </tr>
			<tr><td>Mean interval between customer arrivals (min):
				<td><input type="text" name="MeanArrival" value="1.0" /> </tr>
			<tr><td>Mean cashier transaction time (min):
				<td><input type="text" name="CashierTime" value="1.0" /> </tr>
			<tr><td>Random number generation seed:
				<td><input type="text" name="Seed" value="1234" /> </tr>
			<tr><td>Simulation time (min):
				<td><input type="text" name="Simtime" value="240.0"/> </tr>
		</table>
		<input type="button" value="Run Simulation" id="run_simulation"/>
		</div>
		
		<div class="results">
			<a href="" id="clear_results">Clear</a><hr>
		</div>
	</body>
</html>
	
	